package cn.iocoder.yudao.module.system.dal.mysql.partnerstore;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.partnerstore.PartnerStoreDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.admin.partnerstore.vo.*;

/**
 * 合伙人管理店铺 Mapper
 *
 * @author 万民匠心
 */
@Mapper
public interface PartnerStoreMapper extends BaseMapperX<PartnerStoreDO> {

    default PageResult<PartnerStoreDO> selectPage(PartnerStorePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PartnerStoreDO>()
                .eqIfPresent(PartnerStoreDO::getPartnerId, reqVO.getPartnerId())
                .eqIfPresent(PartnerStoreDO::getStoreId, reqVO.getStoreId())
                .eqIfPresent(PartnerStoreDO::getPartnerCost, reqVO.getPartnerCost())
                .eqIfPresent(PartnerStoreDO::getPartnerType, reqVO.getPartnerType())
                .eqIfPresent(PartnerStoreDO::getPaybackBeforeProfitRate, reqVO.getPaybackBeforeProfitRate())
                .eqIfPresent(PartnerStoreDO::getPaybackAfterProfitRate, reqVO.getPaybackAfterProfitRate())
                .betweenIfPresent(PartnerStoreDO::getShareProfitStartDate, reqVO.getShareProfitStartDate())
                .betweenIfPresent(PartnerStoreDO::getShareProfitEndDate, reqVO.getShareProfitEndDate())
                .eqIfPresent(PartnerStoreDO::getReferrerType, reqVO.getReferrerType())
                .eqIfPresent(PartnerStoreDO::getReferrerProfitRate, reqVO.getReferrerProfitRate())
                .betweenIfPresent(PartnerStoreDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PartnerStoreDO::getId));
    }

}